<template>
  <div>
    <span>{{ title }}</span>
    <span
      ><countTo
        :startVal="num"
        :endVal="num"
        :duration="1000"
        :decimals="decimals ? 2 : 0"
      ></countTo
    ></span>
    <span>{{ unit }}</span>
  </div>
</template>

<script>
import countTo from "vue-count-to";
export default {
  components: {
    countTo,
  },
  props: {
    title: {
      type: String,
    },
    num: {
      type: Number,
    },
    unit: {
      type: String,
    },
    decimals: {
      type: Boolean,
      default: false,
    },
  },
};
</script>

<style lang="less" scoped>
div {
  vertical-align: top;
  background: #e2eaff;
  border-radius: 10px;
  display: inline-block;
  margin-right: 20px;
  margin-bottom: 20px;
  // & > div:nth-child(2),
  //   & > div:nth-child(3) {
  position: relative;
  width: calc(50% - 20px);
  min-width: 320px;
  height: 80px;
  padding: 15px;
  & > span {
    line-height: 50px;
    font-size: 16px;
    font-family: "Source Han Sans CN";
    font-weight: 400;
    color: #303133;
    display: inline-block;
    vertical-align: top;
  }
  & > span:nth-child(2) {
    font-size: 28px;
    font-weight: 500;
    // line-height: 68px;
    position: absolute;
    right: 56px;
  }
  & > span:nth-child(3) {
    position: absolute;
    right: 26px;
  }
  // }
}
@media screen and (max-width: 1000px) {
  div {
    width: 100%;
  }
}
</style>
